import {Injectable} from '@angular/core';
import {HttpClient, HttpParams} from '@angular/common/http';
import {SERVER_URL} from '../../app/config';

export interface ReturnData {
  ret: number;
  data: string;
  msg: string;
}

@Injectable({
  providedIn: 'root'
})

export class FoodService {

  constructor(public http: HttpClient) {
  }

  getAll(apiInfo, formData) {
    return this.http.post<ReturnData>(SERVER_URL + apiInfo, formData).toPromise();
  }

  post(apiInfo, formData) {
    return this.http.post<ReturnData>(SERVER_URL + apiInfo, formData);
  }
}
